//
//  CZLoginViewController.m
//  WeChat
//
//  Created by imac on 18/5/7.
//  Copyright © 2018年 team05. All rights reserved.
//

#import "CZLoginViewController.h"

@interface CZLoginViewController ()
- (IBAction)cancel;
- (IBAction)login;
@property (strong, nonatomic) IBOutlet UITextField *nameField;
@property (strong, nonatomic) IBOutlet UITextField *passwordField;
@property (strong, nonatomic) IBOutlet UIButton *button;
@property (strong, nonatomic) IBOutlet UIButton *button1;
@end

@implementation CZLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.button.layer.cornerRadius = 5;
    self.button.clipsToBounds = YES;
    self.button1.layer.cornerRadius = 5;
    self.button1.clipsToBounds = YES;
    [self.nameField becomeFirstResponder];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (IBAction)cancel {
    [self.view endEditing:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)login {
    if ([self.nameField.text isEqualToString:@"team05"] && [self.passwordField.text isEqualToString:@"123456"]) {
        [self.view endEditing:YES];
        [self performSegueWithIdentifier:@"1" sender:nil];
    }else{
        UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"系统信息" message:@"用户名或密码错误，请重新输入！" preferredStyle:UIAlertControllerStyleAlert];
        UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
        [alertC addAction:action];
        [self presentViewController:alertC animated:YES completion:nil];
        return;
    }
}
@end
